<?php
class Home extends MY_SecuredController {
	public function __construct() {
		parent::MY_SecuredController();

		$this->requireRole('User');
		$this->load->helper(array('form','url'));

		$this->load->library('converter');

		$this->lang->load('home');
		$this->lang->load('profile');
	}

	public function index($civlid) {
		$this->_preRender($civlid);
			
		$person = PersonModel::getPerson($civlid);
			
		$data['person'] = $person;
		$data['pilot'] = $person->Pilot;

		$uid = $person->Pilot->leonardo_id;
		if ($uid) {
			$data['flights'] = LeonardoFlightModel::getLatestFlightSummaryForUser($uid);
		}
			
		$this->render('home', $data);
	}
}
